---
title: Preview as PDF
summary: Renders a package/XML pair specifically as a PDF through the xPression Design service.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-09-01
library: SAIF.Services.Printing
reference_type: embedded
operation_id: op-02-preview-as-pdf
trigger: clsPrint.previewPDF invoked
---

# Preview as PDF

Renders a package name and xPression data XML specifically as a PDF, returning the rendered PDF bytes without printing or distributing the result.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-02 |
| **Trigger** | `clsPrint.previewPDF` invoked |
| **Inputs** | Package name, xPression data XML |
| **Outputs** | PDF bytes (`Byte()`) |
| **Primary components** | `clsPrint.previewPDF`, private `xpreviewPDF`, `m_Xpresso.previewPDF` |
| **Entry point** | `SAIF.Services.Printing/clsPrint.vb` |

## Steps

1. Trims and assigns `inPackage` to the `Package` property. The package name is normalized by stripping a trailing `.pkg` extension via the `Package` setter ([BR-PRT-001](../business-rules.md#br-prt-001-package-name-extension-normalization)) — the same normalization applied in [Preview a document](op-01-preview-a-document.md).
2. Assigns `inXML` to the `XML` property.
3. Calls the private `xpreviewPDF(m_Package, inXML, "xPression Design")`, a thin pass-through to `m_Xpresso.previewPDF(inDocumentName, inXML, inApplication)`.
   - The application name `"xPression Design"` is passed as a hard-coded literal rather than the `m_Application` field used implicitly by [Preview a document](op-01-preview-a-document.md)'s private `previewDocument()`. Both happen to default to the same string, but this operation's call site is structurally distinct: it cannot be overridden by setting the `Application` property.*
4. Returns the PDF bytes from `m_Xpresso.previewPDF` directly to the caller.

## Process flow

```mermaid
flowchart TD
	Start(["previewPDF invoked"]) --> Norm["Normalize package name"]
	Norm --> SetXML["Set XML"]
	SetXML --> Call["xpreviewPDF<br>(hard-coded<br>'xPression Design')"]
	Call --> Svc["m_Xpresso.previewPDF"]
	Svc --> End(["Return PDF bytes"])
```

## Failure and edge-case behavior
- There is no try/catch around the web service call, the same as [Preview a document](op-01-preview-a-document.md); any exception raised by `m_Xpresso.previewPDF` propagates directly to the caller.
- This entry point has no output-profile parameter; PDF is implied by the method itself rather than by a caller-supplied or instance-level `OutputProfile` value.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Dependencies](../dependencies.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Configuration](../configuration.md)
- [API reference](../api/index.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Services.Printing/clsPrint.vb`
